package test;

import main.SubsetGenerator;

public class SubsetTester {
	
	private static void print(int[] tab) {
		String tmp = "";
		for (int i = 0; i <tab.length; i++) {
			tmp += tab[i];
		}
		System.out.println(tmp);
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
/*		SubsetGenerator sg = new SubsetGenerator();
		System.out.println("normal 5:4");
		sg.generate(5, 4);
		System.out.println("negative:");
		sg.generate(1, -1);
		System.out.println("egual:");
		sg.generate(5, 5);
		System.out.println("wrong N<K:");
		sg.generate(3, 5);
		System.out.println("zeros:");
		sg.generate(0, 3);*/
		
		SubsetGenerator sg;
		System.out.println("normal 5:3");
		sg = new SubsetGenerator(5, 3);
		if(sg.generateAll() == null)
			System.out.println("FAILED");
		
		while(sg.hasNext()){
			print(sg.getNext());
		}
		
		System.out.println("negative:");
		sg = new SubsetGenerator(1, -1);
		if(sg.generateAll() != null)
			System.out.println("FAILED");
		while(sg.hasNext()){
			print(sg.getNext());
		}
		
		System.out.println("egual:");
		sg = new SubsetGenerator(5, 5);
		if(sg.generateAll() == null)
			System.out.println("FAILED");
		while(sg.hasNext()){
			print(sg.getNext());
		}
		
		System.out.println("wrong N<K:");
		sg = new SubsetGenerator(3, 5);
		if(sg.generateAll() != null)
			System.out.println("FAILED");
		while(sg.hasNext()){
			print(sg.getNext());
		}
		
		System.out.println("zeros:");
		sg = new SubsetGenerator(0, 3);
		if(sg.generateAll() != null)
			System.out.println("FAILED");
		while(sg.hasNext()){
			print(sg.getNext());
		}
	}

}
